<template>
  <div class="list-page">
    <div class="filter-container header-box" v-if="$slots.filter">
      <slot name="filter"></slot>
    </div>
    <div class="operate-container content-box" v-if="$slots.operate">
      <slot name="operate"></slot>
    </div>
    <div class="wrapper">
      <div class="table-container">
        <slot name="table"></slot>
      </div>
      <div class="pagination-container">
        <slot name="pagination"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ListPage'
}
</script>

<style scoped>
.list-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px);
  /* 总高度限制为视口高度 */
}

/* 容器1和2的隐藏类 */
.filter-container.hidden,
.operate-container.hidden {
  display: none;
}

.wrapper {
  flex: 1;
  min-height: 0;
  /* 允许内容压缩 */
  display: flex;
  flex-direction: column;
}

.table-container {
  /* 占据剩余空间 */
  flex: 1;
  /* 底部间距 */
  /* margin: 0 5px 5px 5px; */
  /* 内容过多时滚动 */
  overflow: auto;
  background: #fff;
}

.pagination-container {
  flex-shrink: 0;
  /* 禁止压缩 */
  /* 可选样式 */
  padding: 10px;
  background: #fff;
}

.header-box {
  background: #fff;
  padding: 10px;
}

.content-box {
  background: #fff;
  padding: 10px;
  /* margin: 0 5px 5px 5px; */
  border-radius: 4px;
}

/deep/ .el-form-item {
  margin-bottom: 0;
}
</style>
